<template>
	<div class="work-info">
		<div class="wd-info-left">
			<div class="wd-info-left-img">
				<img width="210px" height="280px" :src="info.thumUrl" />
			</div>
		</div>
		<div class="wd-info-right">
			<div class="wd-info-right-top">
				<p class="works-intro-title">
					<label>{{info.name}}</label>
					<button v-bind:class="['wi_love' ,isCollection ? 'wi_love_selected':'wi_love_normal']" v-on:click="collectBtnClick()"
					 title="收藏"></button>
				</p>
				<p class="works-intro-digi">
					<label>作者：{{info.author}} 人气：{{info.clickCount}}</label>
				</p>
				
				<p class="works-intro-short">
					<label>{{info.desciption}}</label>
				</p>
				<p class="update-time-father"><label class="update-time">{{getShowData(info.updateTime)}}</label></p>
			</div>
			<div class="wd-info-right-bottom" v-if="loadStatus == 1">
				<router-link class="works-intro-view" :title="'开始阅读'+info.name" :to="{ path: '/LookComic', query: {charptId:this.extInfo.lastChapterId > 0 ? this.extInfo.lastChapterId:firstCharptId, productId: productId }}">{{this.extInfo.lastChapterId > 0 ?"继续阅读":"开始阅读"}}</router-link>
	
			</div>
		</div>
	</div>
</template>

<script>
	import SLMComm from "../../js/SLMComm.js"
	//父组件传值过来
	export default {
		props: ["info","extInfo","firstCharptId","productId","loadStatus"],
		data() {
			return {
				isCollection: false,
			}
		},
		methods: {
			getShowData:function(date) {
				if (date) {
					let result = SLMComm.dataForamt(date, "yyyy年MM月dd日")
					console.log("转时间："+result)
					return result
				}
				return ""
			},
			collectBtnClick: function() {
				this.isCollection = !this.isCollection
				//console.log("点击后的值：" + JSON.stringify(this.isCollection))
				this.$emit('collectBtnClick', this.isCollection)
		
			},
			updateExtInfo:function(curVal) {
				console.log("PC详情值改变：" + JSON.stringify(curVal))
				this.isCollection = curVal.isCollection
			}
		},
		mounted() {
			console.log("作品详情拿到ExtInfo：" + JSON.stringify(this.extInfo))
			console.log("作品详情拿到作品信息：" + JSON.stringify(this.info))
			console.log("mounted isCollection：" + this.isCollection)
			this.isCollection = this.extInfo.isCollection
		}
	}
</script>

<style>
	.work-info {
		width: 100%;
		height: 332px;
		/* clear: both; */
		border-bottom: 1px solid #cec7bd;
		/* border: 1px solid #cec7bd; */
		box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
		/* margin-top: 10px; */
		flex-direction: row;
		display: flex;
		align-items: stretch;
	}
	
	.wd-info-left {
		width: 250px;
	
		/* float: left; */
	
	
	}
	
	.wd-info-left-img {
		margin: 34px 20px 0px 20px;
		width: 210px;
		height: 280px;
		background-color: #f3f3f3;
	}
	
	.wd-info-right {
		/* width: 80%; */
		height: 332px;
		/* float: left; */
		flex: 1;
	}
	
	.work-info .wi_love {
		width: 45px;
		height: 45px;
	}
	
	.work-info .wi_love_selected {
		background: url(../../resources/images/tabbar/love_tabbar_selected.png) no-repeat;
		background-size: 45px 45px;
	}
	
	.work-info .wi_love_normal {
		background: url(../../resources/images/tabbar/love_tabbar.png) no-repeat;
		background-size: 45px 45px;
	}
	
	.wd-info-right-top {
		border-bottom: 1px dashed #999;
		margin: 34px 10px 20px 10px;
		padding-bottom: 20px;
		text-align: -webkit-left;
	}
	.wd-info-right-top .update-time-father {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
	}
	
	.wd-info-right-top .update-time {
		color: #5f5e5d;
	}
	
	.works-intro-title {
		/*作品名*/
		padding-bottom: 10px;
		margin-right: 10px;
	}
	
	.works-intro-title label {
		font-size: 32px;
	}
	
	.works-intro-digi {
		/*作者人气*/
		padding: 20px 0 10px 0;
		font-size: 12px;
	}
	
	.works-intro-short {
		/*简介*/
		width: 100%;
		height: 54px;
		overflow: hidden;
		font-size: 12px;
	}
	
	.wd-info-right-bottom {
		clear: both;
	}
	
	.works-intro-view {
		/*阅读按钮*/
		float: left;
		width: 112px;
		height: 45px;
		line-height: 45px;
		text-align: center;
		font-size: 18px;
		text-shadow: 0 0 0 #fff;
		margin-right: 10px;
		background: #f89157;
		box-shadow: 0 0 1px rgba(255, 255, 255, 0.5) inset;
		border: 1px solid #ec7d4d;
		color: #fff;
		border-radius: 3px;
		text-decoration: none;
	}
	
</style>
